﻿using System;

namespace YArchitech.HCLoad.Utils
{
	public class HcConvert
	{
		public static StringFilterType ToStringFilterType(int i)
		{
			return (StringFilterType)Enum.ToObject(typeof(StringFilterType), i);
		}

		public static RangeFilterType ToRangeFilterType(int i)
		{
			return (RangeFilterType)Enum.ToObject(typeof(RangeFilterType), i);
		}

		public static double ToDouble(string str)
		{
			if (str == null || string.Empty == str)
			{
				return 0.0;
			}
			if (HcUtils.IsNum(str))
			{
				return Convert.ToDouble(str);
			}
			return 0.0;
		}
	}
}
